<template>
  <div class="select">
    <input @click="ClickStatus=!ClickStatus" type="text" v-model="sigleSelct" @keyup="termSearch">
    <ul v-show="ClickStatus">
      <li v-for="(items,index) in DataList" @click="getSingleVal(items.code)">{{items.name}}</li>
    </ul>
  </div>
</template>
<script>
  import {mapGetters} from 'vuex'

  export default {
    props: {
      DataList: {
        type: Array,
        default: []
      },
      url: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        sigleSelct: '',
        ClickStatus: false,
        code: ''
      }
    },
    methods: {
      getSingleVal(val) {
        if (this.code === val) {

        } else {
          this.code = val
          this.$emit('getSingleVal', val)
        }
      },
      termSearch() {
        console.log(this.tooken)
      }
    },
    watch: {
      'DataList': (newVal, oldVal) => {
        console.log(newVal, oldVal)
      }
    },
    computed: {
      ...mapGetters([
        'tooken'
      ])
    },
    created() {
      console.log(this.url)
    }
  }
</script>
<style lang="less" scoped>

</style>
